

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
    <style>
    /* base */
    html,
    body,
    .container {
      width: 100%;
      height: 100%;
    }

    a,
    a:link,
    a:visited {
      text-decoration: none;
      color: inherit;
    }

    ul {
      list-style: none;
    }

    *,
    ::before,
    ::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    *:focus {
      outline: 0;
    }

    .container {
      display: flex;
      padding-top: 20px;
    }

    /* Nav */
    .container .doc-nav {
      position: fixed;
      height: 100%;
      margin: 0 30px 0 40px;
      width: 280px;
    }

    .doc-nav .nav-header {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      background-color: rgb(240, 241, 242);
      height: 40px;
      padding: 16px;
      font-size: 18px;
      font-weight: 500;
      color: rgb(62, 64, 66);
      cursor: pointer;
    }

    .doc-nav .nav-content {
      height: calc(100% - 40px);
      overflow-y: auto;
      color: rgb(32, 34, 36);
    }

    .doc-nav .nav-content .nav-list,
    .doc-nav .nav-content .nav-sub-list {
      line-height: 1.5rem;
    }

    .doc-nav .nav-content .nav-label {
      display: inline-block;
      position: relative;
      padding: 2px 0 2px 20px;
      margin-bottom: 4px;
    }

    .doc-nav .nav-content .nav-sub-label {
      position: relative;
      padding: 2px 0 2px 40px;
      font-size: 14px;
    }

    .doc-nav .nav-content .nav-sub-label:hover {
      text-decoration: underline;
    }

    .doc-nav .nav-content .nav-list .nav-label.group::before {
      border-bottom: 0.25rem solid transparent;
      border-left: 0.25rem solid #6e7072;
      border-right: 0;
      border-top: 0.25rem solid transparent;
      content: '';
      display: block;
      height: 0;
      left: 0.5rem;
      position: absolute;
      top: 0.625rem;
      transition: transform 0.1s linear;
      width: 0;
    }

    .doc-nav .nav-content .nav-list .nav-label.group.active::before {
      transform: rotate(90deg);
    }

    /* doc content */
    .container .doc-content {
      position: fixed;
      height: 100%;
      width: calc(100% - 80px - 40px - 30px - 240px);
      right: 0%;
      overflow-y: auto;
    }

    .doc-title {
      border-bottom: 1px solid #dcdee0;
      font-size: 22px;
      margin: 8px 0 0;
      padding-bottom: 16px;
    }

    .doc-content h3 {
      font-size: 24px;
      font-weight: 600;
      margin: 24px 0;
    }

    .doc-content h4 {
      font-size: 22px;
      font-weight: 500;
      margin: 30px 0 8px;
    }

    .doc-content h4 span {
      color: #007d9c;
    }

    .doc-content .doc-declare {
      background-color: #fafafa;
      border-radius: 5px;
      border: 1px solid #ccc;
      font-size: 14px;
      overflow-x: auto;
      padding: 10px;
      tab-size: 4;
      line-height: 20px;
    }

    .doc-content .doc-comment {
      font-size: 16px;
      margin: 16px 0;
      line-height: 24px;
      word-break: break-word;
    }
  </style>

</head>
<body>
  <div class="container">
    <div class="doc-nav">
      <a href="#Documentation" class="nav-header">Documentation</a>
      <nav class="nav-content">
        <ul class="nav-list">
          <li>
            <a href="#includes" class="nav-label">Includes</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#config.h" class="nav-sub-label">config.h</a>
              </li>
      

              <li>
                <a href="#MBEDTLS_CONFIG_FILE" class="nav-sub-label">MBEDTLS_CONFIG_FILE</a>
              </li>
      

              <li>
                <a href="#cipher.h" class="nav-sub-label">cipher.h</a>
              </li>
      

              <li>
                <a href="#ccm_alt.h" class="nav-sub-label">ccm_alt.h</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#macros" class="nav-label">Macros</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#MBEDTLS_CCM_H" class="nav-sub-label">MBEDTLS_CCM_H</a>
              </li>
      

              <li>
                <a href="#MBEDTLS_ERR_CCM_BAD_INPUT" class="nav-sub-label">MBEDTLS_ERR_CCM_BAD_INPUT</a>
              </li>
      

              <li>
                <a href="#MBEDTLS_ERR_CCM_AUTH_FAILED" class="nav-sub-label">MBEDTLS_ERR_CCM_AUTH_FAILED</a>
              </li>
      

              <li>
                <a href="#MBEDTLS_ERR_CCM_HW_ACCEL_FAILED" class="nav-sub-label">MBEDTLS_ERR_CCM_HW_ACCEL_FAILED</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#functions" class="nav-label">Functions</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#mbedtls_ccm_init" class="nav-sub-label">mbedtls_ccm_init</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_setkey" class="nav-sub-label">mbedtls_ccm_setkey</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_free" class="nav-sub-label">mbedtls_ccm_free</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_encrypt_and_tag" class="nav-sub-label">mbedtls_ccm_encrypt_and_tag</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_star_encrypt_and_tag" class="nav-sub-label">mbedtls_ccm_star_encrypt_and_tag</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_auth_decrypt" class="nav-sub-label">mbedtls_ccm_auth_decrypt</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_star_auth_decrypt" class="nav-sub-label">mbedtls_ccm_star_auth_decrypt</a>
              </li>
      

              <li>
                <a href="#mbedtls_ccm_self_test" class="nav-sub-label">mbedtls_ccm_self_test</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#vars" class="nav-label">Vars</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#consts" class="nav-label">Consts</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#types" class="nav-label">Types</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#typedefs" class="nav-label">Typedefs</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#
mbedtls_ccm_context;
" class="nav-sub-label">
mbedtls_ccm_context;
</a>
              </li>
      
            </ul>
            
          </li>
        </ul>
      </nav>
    </div>
    <div class="doc-content">
      <h2 id="Documentation" class="doc-title">Documentation</h2>
      <h3 id="includes">Includes</h3>
      

      <h4 id="config.h"><span>config.h</span></h4>
      <pre class="doc-declare"><code>#include "config.h"
</code></pre>
      <pre class="doc-comment">#include "config.h"
</pre>

      <h4 id="MBEDTLS_CONFIG_FILE"><span>MBEDTLS_CONFIG_FILE</span></h4>
      <pre class="doc-declare"><code>#include MBEDTLS_CONFIG_FILE
</code></pre>
      <pre class="doc-comment">#include MBEDTLS_CONFIG_FILE
</pre>

      <h4 id="cipher.h"><span>cipher.h</span></h4>
      <pre class="doc-declare"><code>#include "cipher.h"
</code></pre>
      <pre class="doc-comment">#include "cipher.h"
</pre>

      <h4 id="ccm_alt.h"><span>ccm_alt.h</span></h4>
      <pre class="doc-declare"><code>#include "ccm_alt.h"
</code></pre>
      <pre class="doc-comment">#include "ccm_alt.h"
</pre>
      <h3 id="macros">Macros</h3>
      

      <h4 id="MBEDTLS_CCM_H">Marco <span>MBEDTLS_CCM_H</span></h4>
      <pre class="doc-declare"><code>#define MBEDTLS_CCM_H
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="MBEDTLS_ERR_CCM_BAD_INPUT">Marco <span>MBEDTLS_ERR_CCM_BAD_INPUT</span></h4>
      <pre class="doc-declare"><code>#define MBEDTLS_ERR_CCM_BAD_INPUT      0D /**< Bad input parameters to the function. */
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="MBEDTLS_ERR_CCM_AUTH_FAILED">Marco <span>MBEDTLS_ERR_CCM_AUTH_FAILED</span></h4>
      <pre class="doc-declare"><code>#define MBEDTLS_ERR_CCM_AUTH_FAILED    -15 /**< Authenticated decryption failed. */
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="MBEDTLS_ERR_CCM_HW_ACCEL_FAILED">Marco <span>MBEDTLS_ERR_CCM_HW_ACCEL_FAILED</span></h4>
      <pre class="doc-declare"><code>#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED -17 /**< CCM hardware accelerator failed. */
</code></pre>
      <pre class="doc-comment">/* MBEDTLS_ERR_CCM_HW_ACCEL_FAILED is deprecated and should not be used. */</pre>
      <h3 id="functions">Functions</h3>
      

      <h4 id="mbedtls_ccm_init">Func <span>mbedtls_ccm_init</span></h4>
      <pre class="doc-declare"><code>void mbedtls_ccm_init( mbedtls_ccm_context *ctx );</code></pre>
      <pre class="doc-comment">/**
 * \brief           This function initializes the specified CCM context,
 *                  to make references valid, and prepare the context
 *                  for mbedtls_ccm_setkey() or mbedtls_ccm_free().
 *
 * \param ctx       The CCM context to initialize. This must not be \c NULL.
 */</pre>

      <h4 id="mbedtls_ccm_setkey">Func <span>mbedtls_ccm_setkey</span></h4>
      <pre class="doc-declare"><code>int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
                       mbedtls_cipher_id_t cipher,
                       const unsigned char *key,
                       unsigned int keybits );</code></pre>
      <pre class="doc-comment">/**
 * \brief           This function initializes the CCM context set in the
 *                  \p ctx parameter and sets the encryption key.
 *
 * \param ctx       The CCM context to initialize. This must be an initialized
 *                  context.
 * \param cipher    The 128-bit block cipher to use.
 * \param key       The encryption key. This must not be \c NULL.
 * \param keybits   The key size in bits. This must be acceptable by the cipher.
 *
 * \return          \c 0 on success.
 * \return          A CCM or cipher-specific error code on failure.
 */</pre>

      <h4 id="mbedtls_ccm_free">Func <span>mbedtls_ccm_free</span></h4>
      <pre class="doc-declare"><code>void mbedtls_ccm_free( mbedtls_ccm_context *ctx );</code></pre>
      <pre class="doc-comment">/**
 * \brief   This function releases and clears the specified CCM context
 *          and underlying cipher sub-context.
 *
 * \param ctx       The CCM context to clear. If this is \c NULL, the function
 *                  has no effect. Otherwise, this must be initialized.
 */</pre>

      <h4 id="mbedtls_ccm_encrypt_and_tag">Func <span>mbedtls_ccm_encrypt_and_tag</span></h4>
      <pre class="doc-declare"><code>int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
                        const unsigned char *iv, size_t iv_len,
                        const unsigned char *add, size_t add_len,
                        const unsigned char *input, unsigned char *output,
                        unsigned char *tag, size_t tag_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           This function encrypts a buffer using CCM.
 *
 * \note            The tag is written to a separate buffer. To concatenate
 *                  the \p tag with the \p output, as done in <em>RFC-3610:
 *                  Counter with CBC-MAC (CCM)</em>, use
 *                  \p tag = \p output + \p length, and make sure that the
 *                  output buffer is at least \p length + \p tag_len wide.
 *
 * \param ctx       The CCM context to use for encryption. This must be
 *                  initialized and bound to a key.
 * \param length    The length of the input data in Bytes.
 * \param iv        The initialization vector (nonce). This must be a readable
 *                  buffer of at least \p iv_len Bytes.
 * \param iv_len    The length of the nonce in Bytes: 7, 8, 9, 10, 11, 12,
 *                  or 13. The length L of the message length field is
 *                  15 - \p iv_len.
 * \param add       The additional data field. If \p add_len is greater than
 *                  zero, \p add must be a readable buffer of at least that
 *                  length.
 * \param add_len   The length of additional data in Bytes.
 *                  This must be less than `2^16 - 2^8`.
 * \param input     The buffer holding the input data. If \p length is greater
 *                  than zero, \p input must be a readable buffer of at least
 *                  that length.
 * \param output    The buffer holding the output data. If \p length is greater
 *                  than zero, \p output must be a writable buffer of at least
 *                  that length.
 * \param tag       The buffer holding the authentication field. This must be a
 *                  readable buffer of at least \p tag_len Bytes.
 * \param tag_len   The length of the authentication field to generate in Bytes:
 *                  4, 6, 8, 10, 12, 14 or 16.
 *
 * \return          \c 0 on success.
 * \return          A CCM or cipher-specific error code on failure.
 */</pre>

      <h4 id="mbedtls_ccm_star_encrypt_and_tag">Func <span>mbedtls_ccm_star_encrypt_and_tag</span></h4>
      <pre class="doc-declare"><code>int mbedtls_ccm_star_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
                        const unsigned char *iv, size_t iv_len,
                        const unsigned char *add, size_t add_len,
                        const unsigned char *input, unsigned char *output,
                        unsigned char *tag, size_t tag_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           This function encrypts a buffer using CCM*.
 *
 * \note            The tag is written to a separate buffer. To concatenate
 *                  the \p tag with the \p output, as done in <em>RFC-3610:
 *                  Counter with CBC-MAC (CCM)</em>, use
 *                  \p tag = \p output + \p length, and make sure that the
 *                  output buffer is at least \p length + \p tag_len wide.
 *
 * \note            When using this function in a variable tag length context,
 *                  the tag length has to be encoded into the \p iv passed to
 *                  this function.
 *
 * \param ctx       The CCM context to use for encryption. This must be
 *                  initialized and bound to a key.
 * \param length    The length of the input data in Bytes.
 * \param iv        The initialization vector (nonce). This must be a readable
 *                  buffer of at least \p iv_len Bytes.
 * \param iv_len    The length of the nonce in Bytes: 7, 8, 9, 10, 11, 12,
 *                  or 13. The length L of the message length field is
 *                  15 - \p iv_len.
 * \param add       The additional data field. This must be a readable buffer of
 *                  at least \p add_len Bytes.
 * \param add_len   The length of additional data in Bytes.
 *                  This must be less than 2^16 - 2^8.
 * \param input     The buffer holding the input data. If \p length is greater
 *                  than zero, \p input must be a readable buffer of at least
 *                  that length.
 * \param output    The buffer holding the output data. If \p length is greater
 *                  than zero, \p output must be a writable buffer of at least
 *                  that length.
 * \param tag       The buffer holding the authentication field. This must be a
 *                  readable buffer of at least \p tag_len Bytes.
 * \param tag_len   The length of the authentication field to generate in Bytes:
 *                  0, 4, 6, 8, 10, 12, 14 or 16.
 *
 * \warning         Passing \c 0 as \p tag_len means that the message is no
 *                  longer authenticated.
 *
 * \return          \c 0 on success.
 * \return          A CCM or cipher-specific error code on failure.
 */</pre>

      <h4 id="mbedtls_ccm_auth_decrypt">Func <span>mbedtls_ccm_auth_decrypt</span></h4>
      <pre class="doc-declare"><code>int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
                     const unsigned char *iv, size_t iv_len,
                     const unsigned char *add, size_t add_len,
                     const unsigned char *input, unsigned char *output,
                     const unsigned char *tag, size_t tag_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           This function performs a CCM authenticated decryption of a
 *                  buffer.
 *
 * \param ctx       The CCM context to use for decryption. This must be
 *                  initialized and bound to a key.
 * \param length    The length of the input data in Bytes.
 * \param iv        The initialization vector (nonce). This must be a readable
 *                  buffer of at least \p iv_len Bytes.
 * \param iv_len    The length of the nonce in Bytes: 7, 8, 9, 10, 11, 12,
 *                  or 13. The length L of the message length field is
 *                  15 - \p iv_len.
 * \param add       The additional data field. This must be a readable buffer
 *                  of at least that \p add_len Bytes..
 * \param add_len   The length of additional data in Bytes.
 *                  This must be less than 2^16 - 2^8.
 * \param input     The buffer holding the input data. If \p length is greater
 *                  than zero, \p input must be a readable buffer of at least
 *                  that length.
 * \param output    The buffer holding the output data. If \p length is greater
 *                  than zero, \p output must be a writable buffer of at least
 *                  that length.
 * \param tag       The buffer holding the authentication field. This must be a
 *                  readable buffer of at least \p tag_len Bytes.
 * \param tag_len   The length of the authentication field to generate in Bytes:
 *                  4, 6, 8, 10, 12, 14 or 16.
 *
 * \return          \c 0 on success. This indicates that the message is authentic.
 * \return          #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match.
 * \return          A cipher-specific error code on calculation failure.
 */</pre>

      <h4 id="mbedtls_ccm_star_auth_decrypt">Func <span>mbedtls_ccm_star_auth_decrypt</span></h4>
      <pre class="doc-declare"><code>int mbedtls_ccm_star_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
                     const unsigned char *iv, size_t iv_len,
                     const unsigned char *add, size_t add_len,
                     const unsigned char *input, unsigned char *output,
                     const unsigned char *tag, size_t tag_len );</code></pre>
      <pre class="doc-comment">/**
 * \brief           This function performs a CCM* authenticated decryption of a
 *                  buffer.
 *
 * \note            When using this function in a variable tag length context,
 *                  the tag length has to be decoded from \p iv and passed to
 *                  this function as \p tag_len. (\p tag needs to be adjusted
 *                  accordingly.)
 *
 * \param ctx       The CCM context to use for decryption. This must be
 *                  initialized and bound to a key.
 * \param length    The length of the input data in Bytes.
 * \param iv        The initialization vector (nonce). This must be a readable
 *                  buffer of at least \p iv_len Bytes.
 * \param iv_len    The length of the nonce in Bytes: 7, 8, 9, 10, 11, 12,
 *                  or 13. The length L of the message length field is
 *                  15 - \p iv_len.
 * \param add       The additional data field. This must be a readable buffer of
 *                  at least that \p add_len Bytes.
 * \param add_len   The length of additional data in Bytes.
 *                  This must be less than 2^16 - 2^8.
 * \param input     The buffer holding the input data. If \p length is greater
 *                  than zero, \p input must be a readable buffer of at least
 *                  that length.
 * \param output    The buffer holding the output data. If \p length is greater
 *                  than zero, \p output must be a writable buffer of at least
 *                  that length.
 * \param tag       The buffer holding the authentication field. This must be a
 *                  readable buffer of at least \p tag_len Bytes.
 * \param tag_len   The length of the authentication field in Bytes.
 *                  0, 4, 6, 8, 10, 12, 14 or 16.
 *
 * \warning         Passing \c 0 as \p tag_len means that the message is nos
 *                  longer authenticated.
 *
 * \return          \c 0 on success.
 * \return          #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match.
 * \return          A cipher-specific error code on calculation failure.
 */</pre>

      <h4 id="mbedtls_ccm_self_test">Func <span>mbedtls_ccm_self_test</span></h4>
      <pre class="doc-declare"><code>int mbedtls_ccm_self_test( int verbose );</code></pre>
      <pre class="doc-comment">/**
 * \brief          The CCM checkup routine.
 *
 * \return         \c 0 on success.
 * \return         \c 1 on failure.
 */</pre>
      <h3 id="vars">Vars</h3>
      
      <h3 id="consts">Consts</h3>
      
      <h3 id="types">Types</h3>
      
      <h3 id="typedefs">Typedefs</h3>
      

      <h4 id="
mbedtls_ccm_context;
">Typedef <span>
mbedtls_ccm_context;
</span></h4>
      <pre class="doc-declare"><code>typedef struct mbedtls_ccm_context
{
   mbedtls_cipher_context_t cipher_ctx;   /*!< The cipher context used. */
}
mbedtls_ccm_context;
</code></pre>
      <pre class="doc-comment">/**
 * \brief    The CCM context-type definition. The CCM context is passed
 *           to the APIs called.
 */</pre>
    </div>
  </body>
</html>
            